#ifndef SESSION_MANAGER_H
#define SESSION_MANAGER_H

#include <QtCore/QObject>
#include <QtCore/QSharedPointer>

namespace core
{
class IDocument;
class IPersistenceAssistant;
class ISessionProvider;

class SessionManager : public QObject
{
    Q_OBJECT

public:
    static SessionManager* getInstance();
    static void destroy();

    void setSessionProvider(ISessionProvider* sessionProvider);

private:
    SessionManager();
    ~SessionManager();
    QSharedPointer<IPersistenceAssistant> getNativeAssistant(
            const QSharedPointer<IDocument>& document) const;
    QSharedPointer<IPersistenceAssistant> getNativeAssistant(
            const QString& perDocument, const QString& storage) const;
    void persist();
    void clearSession();
    void writeProjectToSession(const QString& url, const QString& storage);
    void writeDocumentToSession(const QString& url, const QString& storage);

public slots:
    void restoreSession();
    void persistSession();

private:
    ISessionProvider* m_sessionProvider;
    QList<QString> m_projects;
    QList<QString> m_documents;
};

} // namespace core

#endif
